package com.thh.demo.mvc.controller;

import com.thh.demo.mvc.service.IDemoService;
import com.thh.mvcframework.annotation.ThhAutowired;
import com.thh.mvcframework.annotation.ThhController;
import com.thh.mvcframework.annotation.ThhRequestMapping;
import com.thh.mvcframework.annotation.ThhRequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @description:
 * @author: thh
 * @time: 2020/8/1 10:50
 */
@ThhController
@ThhRequestMapping("/one")
public class OneController {

    @ThhAutowired
    private IDemoService demoService;

    @ThhRequestMapping("/query")
    public void query(HttpServletRequest req, HttpServletResponse resp,@ThhRequestParam("name") String name){
        String result = demoService.get(name);
        try {
            resp.getWriter().write(result);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
